package com.dongliu.dao;

import com.dongliu.domain.Admin;
import org.apache.ibatis.annotations.*;

import java.util.List;

// TODO 添加@Mapper
@Mapper
public interface AdminDao {
    @Insert("insert into admin values(null, #{username}, #{password})")
    public int save(Admin admin);

    @Update("update admin set username=#{username}, password=#{password} where id=#{id}")
    public int update(Admin admin);

    @Delete("delete from admin where id=#{id}")
    public int delete(Integer id);

    @Select("select * from admin where id=#{id}")
    public Admin getById(Integer id);

    @Select("select * from admin")
    public List<Admin> getAll();

    @Select("select * from admin where username=#{username} and password=#{password}")
    public Admin login(String username, String password);
}
